package service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import dao.MerchantDao;
import po.Dish;
import po.Merchant;
import service.MerchantService;
import util.Po2Vo;
import vo.MerchantVo;


@Service(value = "merchantService")
public class MerchantServiceImpl implements MerchantService{
	@Autowired(required=true)
	private  MerchantDao merchantDao;
	
	@Override
	@Transactional
	public String updateMerchantGrade(Merchant merchant) {
	
		return merchantDao.updateMerchant(merchant);
	}

	@Override
	public double getMerchantGrade(String mid) {
		return merchantDao.findMerchant(mid).getGrade();
	}

	@Override
	public Merchant getMerchant(String mid) {
		
		return merchantDao.findMerchant(mid);
	}
	@Override
	@Transactional
	public List<Merchant> findAllMerchant(List<String> statusList) {
		return merchantDao.findAllMerchant(statusList);
	}

	@Override
	@Transactional
	public MerchantVo findMerchantByMid(String mid) {
		MerchantVo vo = new MerchantVo();		
		Merchant merchant = merchantDao.findMerchantByMid(mid);
 		return Po2Vo.merchentPo2Vo(merchant);
	}
	
}
